d

Plotting Surfaces

1. Built in Surfaces

Graphics3D[{Red, Opacity[0.3],Sphere[{0,0,1},3],Opacity[1],Blue, Cone[{{0,0,0},{0,0,1}},1],Green,Opacity[0.1],Cuboid[{{-1,-1,-1},{1,1,1}}]}]

2. Tubes

?Tube

r[t_]:={2Cos[t],3Sin[t],t};

helix=ParametricPlot3D[r[t],{t,-4Pi,4Pi},ColorFunction->Function[{x,y,z},RGBColor[1,0,0]],Axes->False]

Show[Normal[helix]/.Line[x__]:>Tube[x,2],PlotRange->All]

Graphics3D[{CapForm[None],Tube[Normal[helix][[1,1,3,2]],2]}]

3. ParametricPlot3D

Sphere

Manipulate[ParametricPlot3D[r {Cos[θ]Cos[ϕ],Cos[ϕ]Sin[θ],Sin[ϕ]},{θ,0,2Pi},{ϕ,0,2Pi},PlotRange->{{-2,2},{-2,2},{-2,2}}],{{r,1,"radius"},0.001,2,Appearance->"Labeled"}]

ParametricPlot3D[{Cos[θ]Cos[ϕ],Cos[ϕ]Sin[θ],Sin[ϕ]},{θ,0,(Pi/2)},{ϕ,0,Pi}]

Torus

circle[θ_]:={0,Sin[θ],Cos[θ]+4}

ParametricPlot3D[circle[t],{t,-Pi,Pi},ColorFunction->(Red&),AxesLabel->{"x","y","z"},ImageSize->Small,Ticks->False]

Clear[tor]

tor[θ_,ϕ_]:=RotationTransform[ϕ,{0,1,0}][circle[θ]]

tor[θ,ϕ]

tr=ParametricPlot3D[tor[θ,ϕ],{θ,-Pi,Pi},{ϕ,-Pi,Pi},Axes->False,Mesh->None,ColorFunction->(Directive[Opacity[0.4],Green]&)]

ParametricPlot3D[tor[θ,ϕ],{θ,-Pi,Pi},{ϕ,-Pi/2,Pi/2},Axes->False]

ϕaxis=ParametricPlot3D[Evaluate[tor[0,ϕ]],{ϕ,-Pi, π},Boxed->False,Axes->False];

θaxis=ParametricPlot3D[Evaluate[tor[θ,0]],{θ,-Pi, π},Boxed->False,Axes->False];

Show[tr,θaxis,ϕaxis,Boxed->False,Axes->False,ImageSize->Small]

Moebius Strip

moebiusstrip[u_,v_]:={Cos[u] + v Cos[u/2] Cos[u],
        Sin[u] + v Cos[u/2] Sin[u],v Sin[u/2]}

ParametricPlot3D[moebiusstrip[u,v],
{u,0,2Pi},{v,-0.5,0.5},
Axes->None,Boxed->False]

mb=ParametricPlot3D[moebiusstrip[u,v],
{u,0,2Pi},{v,-0.5,0.5},
Axes->None,Boxed->False,ColorFunction->Function[{x,y,z},Directive[Opacity[0.2],Blue]]]

mbl=ParametricPlot3D[moebiusstrip[u,0],
{u,0,2Pi},
Axes->None,Boxed->False,ColorFunction->Function[{x,y,z},Red]];

Show[mb,mbl]

Klein Bottle

klein1[θ_,ϕ_]:={(2+Cos[ϕ/2] Sin[θ]-Sin[ϕ/2] Sin[2θ]) Cos[ϕ],(2+Cos[ϕ/2] Sin[θ]-Sin[ϕ/2] Sin[2θ]) Sin[ϕ],Sin[ϕ/2] Sin[θ]+Cos[ϕ/2] Sin[2θ]}

kl1=ParametricPlot3D[klein1[θ,ϕ],{θ,-Pi,Pi},{ϕ,-Pi,Pi},Boxed->False,Axes->False,ColorFunction->(Directive[Opacity[0.3],Green]&),Mesh->False]

ϕaxis=ParametricPlot3D[klein1[0,ϕ],{ϕ,-Pi, Pi},ColorFunction->(Red&)];

θaxis=ParametricPlot3D[klein1[θ,0],{θ,-Pi, Pi},ColorFunction->(Blue&)];

Show[kl1,ϕaxis,θaxis,PlotRange->All,Boxed->False,Axes->False]

klein2[u_,v_]:=With[{bx = 6  Cos[u] (1 + Sin[u]),by = 16  Sin[u],rad = 4 (1 - Cos[u] / 2)},{rad Sin[v],Piecewise[{{bx + rad Cos[v + Pi],Pi < u <= 2 Pi}},bx + rad Cos[u] Cos[v]],Piecewise[{{by,Pi < u <= 2 Pi}},by + rad Sin[u] Cos[v]]}]

kl2=ParametricPlot3D[klein2[θ,ϕ],{θ,-Pi,Pi},{ϕ,-Pi,Pi},Boxed->False,Axes->False,ColorFunction->(Directive[Opacity[0.3],Green]&),Mesh->False]

ϕaxis2=ParametricPlot3D[klein2[0,ϕ],{ϕ,-Pi, Pi},ColorFunction->(Red&)];

θaxis2=ParametricPlot3D[klein2[θ,0],{θ,-Pi, Pi},ColorFunction->(Blue&)];

Show[kl2,ϕaxis2,θaxis2,PlotRange->All,Boxed->False,Axes->False]

The Projective Plane

boySurface[a_][u_,v_]:=a{(((Sqrt[2])Cos[v]^2 Cos[2u]+Cos[u]Sin[2v])/(2-(Sqrt[2])Sin[3u]Sin[2v])),(((Sqrt[2])Cos[v]^2Sin[2u]+Cos[u]Sin[2v])/(2-(Sqrt[2])Sin[3u]Sin[2v])),((3Cos[v]^2)/(2-(Sqrt[2])Sin[3u]Sin[2v]))}

ParametricPlot3D[boySurface[1][u,v],{u,-Pi/2,Pi/2},{v,0,Pi},Mesh->False,Axes->False,Boxed->False,PlotRange->All]

Roman Surface

4. ContourPlot3D

Sphere

ContourPlot3D[(x^2)+(y^2)+(z^2)==1,{x,-2,2},{y,-2,2},{z,-2,2}]

Torus

cartesianTorus[x_,y_,z_]:=(x^4)+2 (y^2) (x^2)+2 (z^2) (x^2)-34 (x^2)+(y^4)+(z^4)+30 (y^2)+2 (y^2) (z^2)-34 (z^2)+225

ContourPlot3D[cartesianTorus[x,y,z]==0,{x,-6,6},{y,-2,2},{z,-6,6},Mesh->False,Boxed->False,Axes->False]

cartesianDoubleTorus[x_,y_,z_]:=-(1/2)+(x^2)+(y^4)-2 (y^2) (z^2)+(z^4)+(((y^2) (z^4))/2)-((z^6)/2)+((z^8)/16)

ContourPlot3D[cartesianDoubleTorus[x,y,z]==0,{x,-3,3},{y,-3,3},{z,-3,3},Mesh->False,Boxed->False,Axes->False]

cartesianKlein[x_,y_,z_]:=768 (x^4)-1024 (x^5)-128 (x^6)+512 (x^7)-80 (x^8)-64 (x^9)+16 (x^10)+144 (x^2) (y^2)-768 (x^3) (y^2)-136 (x^4) (y^2)+896 (x^5) (y^2)-183 (x^6) (y^2)-176 (x^7) (y^2)+52 (x^8) (y^2)+400 (y^4)+256 x (y^4)-912 (x^2) (y^4)+256 (x^3) (y^4)+315 (x^4) (y^4)-144 (x^5) (y^4)-16 (x^6) (y^4)+4 (x^8) (y^4)-904 (y^6)-128 x (y^6)+859 (x^2) (y^6)-16 (x^3) (y^6)-200 (x^4) (y^6)+16 (x^6) (y^6)+441 (y^8)+16 x (y^8)-224 (x^2) (y^8)+24 (x^4) (y^8)-76 (y^10)+16 (x^2) (y^10)+4 (y^12)-2784 (x^3) y z+4112 (x^4) y z-968 (x^5) y z-836 (x^6) y z+416 (x^7) y z-48 (x^8) y z+1312 x (y^3) z+2976 (x^2) (y^3) z-5008 (x^3) (y^3) z-12 (x^4) (y^3) z+2016 (x^5) (y^3) z-616 (x^6) (y^3) z-64 (x^7) (y^3) z+32 (x^8) (y^3) z-1136 (y^5) z-4040 x (y^5) z+2484 (x^2) (y^5) z+2784 (x^3) (y^5) z-1560 (x^4) (y^5) z-192 (x^5) (y^5) z+128 (x^6) (y^5) z+1660 (y^7) z+1184 x (y^7) z-1464 (x^2) (y^7) z-192 (x^3) (y^7) z+192 (x^4) (y^7) z-472 (y^9) z-64 x (y^9) z+128 (x^2) (y^9) z+32 (y^11) z-752 (x^4) (z^2)+1808 (x^5) (z^2)-1468 (x^6) (z^2)+512 (x^7) (z^2)-64 (x^8) (z^2)+6280 (x^2) (y^2) (z^2)-5728 (x^3) (y^2) (z^2)-4066 (x^4) (y^2) (z^2)+5088 (x^5) (y^2) (z^2)-820 (x^6) (y^2) (z^2)-384 (x^7) (y^2) (z^2)+96 (x^8) (y^2) (z^2)-136 (y^4) (z^2)-7536 x (y^4) (z^2)+112 (x^2) (y^4) (z^2)+8640 (x^3) (y^4) (z^2)-2652 (x^4) (y^4) (z^2)-1152 (x^5) (y^4) (z^2)+400 (x^6) (y^4) (z^2)+2710 (y^6) (z^2)+4064 x (y^6) (z^2)-3100 (x^2) (y^6) (z^2)-1152 (x^3) (y^6) (z^2)+624 (x^4) (y^6) (z^2)-1204 (y^8) (z^2)-384 x (y^8) (z^2)+432 (x^2) (y^8) (z^2)+112 (y^10) (z^2)+3896 (x^3) y (z^3)-7108 (x^4) y (z^3)+3072 (x^5) y (z^3)+768 (x^6) y (z^3)-768 (x^7) y (z^3)+128 (x^8) y (z^3)-3272 x (y^3) (z^3)-4936 (x^2) (y^3) (z^3)+8704 (x^3) (y^3) (z^3)-80 (x^4) (y^3) (z^3)-2496 (x^5) (y^3) (z^3)+608 (x^6) (y^3) (z^3)+2172 (y^5) (z^3)+5632 x (y^5) (z^3)-2464 (x^2) (y^5) (z^3)-2688 (x^3) (y^5) (z^3)+1056 (x^4) (y^5) (z^3)-1616 (y^7) (z^3)-960 x (y^7) (z^3)+800 (x^2) (y^7) (z^3)+224 (y^9) (z^3)+752 (x^4) (z^4)-1792 (x^5) (z^4)+1472 (x^6) (z^4)-512 (x^7) (z^4)+64 (x^8) (z^4)-3031 (x^2) (y^2) (z^4)+1936 (x^3) (y^2) (z^4)+2700 (x^4) (y^2) (z^4)-2304 (x^5) (y^2) (z^4)+448 (x^6) (y^2) (z^4)+697 (y^4) (z^4)+3728 x (y^4) (z^4)+24 (x^2) (y^4) (z^4)-3072 (x^3) (y^4) (z^4)+984 (x^4) (y^4) (z^4)-1204 (y^6) (z^4)-1280 x (y^6) (z^4)+880 (x^2) (y^6) (z^4)+280 (y^8) (z^4)-800 (x^3) y (z^5)+1488 (x^4) y (z^5)-768 (x^5) y (z^5)+128 (x^6) y (z^5)+992 x (y^3) (z^5)+1016 (x^2) (y^3) (z^5)-1728 (x^3) (y^3) (z^5)+480 (x^4) (y^3) (z^5)-472 (y^5) (z^5)-960 x (y^5) (z^5)+576 (x^2) (y^5) (z^5)+224 (y^7) (z^5)+16 (x^4) (z^6)+388 (x^2) (y^2) (z^6)-384 (x^3) (y^2) (z^6)+96 (x^4) (y^2) (z^6)-76 (y^4) (z^6)-384 x (y^4) (z^6)+208 (x^2) (y^4) (z^6)+112 (y^6) (z^6)-64 x (y^3) (z^7)+32 (x^2) (y^3) (z^7)+32 (y^5) (z^7)+4 (y^4) (z^8)

ContourPlot3D[cartesianKlein[x,y,z]==0,{x,-5,5},{y,-5,5},{z,-5,5},Mesh->False,Boxed->False,Axes->False]